<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>11-去除数组中含有0的元素</title>
	</head>
	<body>
		<script type="text/javascript">
			var arr = [12,34,56,0,9,0,8,56,0,34,0,0,0];
			//声明一个新的数组
			let newArr = [];
			//循环
			for(var i=0;i<arr.length;i++){
				if(arr[i]!=0){
					newArr[newArr.length] = arr[i];
				}
			}
			//新数组::12,34,56,9,8,56,34
			console.log('新数组::'+newArr);
			
		</script>
		
	</body>
</html>
